/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  dev
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    location    "system";
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

diameter   0.1;

radIn      #calc "$diameter / 2.0";
boxIn      #calc "3.0*$radIn / 10.0";

radVen     #calc "$radIn / 2.0";
boxVen     #calc "$boxIn / 2.0";

xInSt      0;
xInEnd     $diameter;
xVenSt     #calc "$xInEnd  + 1.25*$diameter";
xVenEnd    #calc "$xVenSt  + 0.5*$diameter";
xOutSt     #calc "$xVenEnd + 2.5*$diameter";
xOutEnd    #calc "$xOutSt  + $diameter";

diaCells   16;
venCells    8;
inCells    20;
outCells   40;

boxCells   8;
radCells   16;

outGrading 0.5;

radInN     #neg $radIn;
boxInN     #neg $boxIn;
radVenN    #neg $radVen;
boxVenN    #neg $boxVen;

convertToMeters 1;

vertices
(
    ($xInSt   0        $boxInN)
    ($xInSt   $boxIn   0)
    ($xInSt   0        $boxIn)
    ($xInSt   $boxInN  0)
    ($xInSt   0        $radInN)
    ($xInSt   $radIn   0)
    ($xInSt   0        $radIn)
    ($xInSt   $radInN  0)

    ($xInEnd  0        $boxInN)
    ($xInEnd  $boxIn   0)
    ($xInEnd  0        $boxIn)
    ($xInEnd  $boxInN  0)
    ($xInEnd  0        $radInN)
    ($xInEnd  $radIn   0)
    ($xInEnd  0        $radIn)
    ($xInEnd  $radInN  0)

    ($xVenSt  0        $boxVenN)
    ($xVenSt  $boxVen  0)
    ($xVenSt  0        $boxVen)
    ($xVenSt  $boxVenN 0)
    ($xVenSt  0        $radVenN)
    ($xVenSt  $radVen  0)
    ($xVenSt  0        $radVen)
    ($xVenSt  $radVenN 0)

    ($xVenEnd 0        $boxVenN)
    ($xVenEnd $boxVen  0)
    ($xVenEnd 0        $boxVen)
    ($xVenEnd $boxVenN 0)
    ($xVenEnd 0        $radVenN)
    ($xVenEnd $radVen  0)
    ($xVenEnd 0        $radVen)
    ($xVenEnd $radVenN 0)

    ($xOutSt  0        $boxInN)
    ($xOutSt  $boxIn   0)
    ($xOutSt  0        $boxIn)
    ($xOutSt  $boxInN  0)
    ($xOutSt  0        $radInN)
    ($xOutSt  $radIn   0)
    ($xOutSt  0        $radIn)
    ($xOutSt  $radInN  0)

    ($xOutEnd 0        $boxInN)
    ($xOutEnd $boxIn   0)
    ($xOutEnd 0        $boxIn)
    ($xOutEnd $boxInN  0)
    ($xOutEnd 0        $radInN)
    ($xOutEnd $radIn   0)
    ($xOutEnd 0        $radIn)
    ($xOutEnd $radInN  0)
);

yzBoxCells $boxCells $boxCells;
yzRadCells $boxCells $radCells;
boxGrading simpleGrading (1 1 1);
radGrading simpleGrading (1 1 $outGrading);

blocks
(
    hex (0  8  9  1  3  11 10 2)  ($diaCells $yzBoxCells) $boxGrading
    hex (11 3  0  8  15 7  4  12) ($diaCells $yzRadCells) $radGrading
    hex (10 2  3  11 14 6  7  15) ($diaCells $yzRadCells) $radGrading
    hex (9  1  2  10 13 5  6  14) ($diaCells $yzRadCells) $radGrading
    hex (8  0  1  9  12 4  5  13) ($diaCells $yzRadCells) $radGrading

    hex (8  16 17 9  11 19 18 10) ($inCells  $yzBoxCells) $boxGrading
    hex (19 11 8  16 23 15 12 20) ($inCells  $yzRadCells) $radGrading
    hex (18 10 11 19 22 14 15 23) ($inCells  $yzRadCells) $radGrading
    hex (17 9  10 18 21 13 14 22) ($inCells  $yzRadCells) $radGrading
    hex (16 8  9  17 20 12 13 21) ($inCells  $yzRadCells) $radGrading

    hex (16 24 25 17 19 27 26 18) ($venCells $yzBoxCells) $boxGrading
    hex (27 19 16 24 31 23 20 28) ($venCells $yzRadCells) $radGrading
    hex (26 18 19 27 30 22 23 31) ($venCells $yzRadCells) $radGrading
    hex (25 17 18 26 29 21 22 30) ($venCells $yzRadCells) $radGrading
    hex (24 16 17 25 28 20 21 29) ($venCells $yzRadCells) $radGrading

    hex (24 32 33 25 27 35 34 26) ($outCells $yzBoxCells) $boxGrading
    hex (35 27 24 32 39 31 28 36) ($outCells $yzRadCells) $radGrading
    hex (34 26 27 35 38 30 31 39) ($outCells $yzRadCells) $radGrading
    hex (33 25 26 34 37 29 30 38) ($outCells $yzRadCells) $radGrading
    hex (32 24 25 33 36 28 29 37) ($outCells $yzRadCells) $radGrading

    hex (32 40 41 33 35 43 42 34) ($diaCells $yzBoxCells) $boxGrading
    hex (43 35 32 40 47 39 36 44) ($diaCells $yzRadCells) $radGrading
    hex (42 34 35 43 46 38 39 47) ($diaCells $yzRadCells) $radGrading
    hex (41 33 34 42 45 37 38 46) ($diaCells $yzRadCells) $radGrading
    hex (40 32 33 41 44 36 37 45) ($diaCells $yzRadCells) $radGrading
);

edges
(
    arc 7 4 90 (1 0 0)
    arc 6 7 90 (1 0 0)
    arc 5 6 90 (1 0 0)
    arc 4 5 90 (1 0 0)

    arc 15 12 90 (1 0 0)
    arc 14 15 90 (1 0 0)
    arc 13 14 90 (1 0 0)
    arc 12 13 90 (1 0 0)

    arc 23 20 90 (1 0 0)
    arc 22 23 90 (1 0 0)
    arc 21 22 90 (1 0 0)
    arc 20 21 90 (1 0 0)

    arc 31 28 90 (1 0 0)
    arc 30 31 90 (1 0 0)
    arc 29 30 90 (1 0 0)
    arc 28 29 90 (1 0 0)

    arc 39 36 90 (1 0 0)
    arc 38 39 90 (1 0 0)
    arc 37 38 90 (1 0 0)
    arc 36 37 90 (1 0 0)

    arc 47 44 90 (1 0 0)
    arc 46 47 90 (1 0 0)
    arc 45 46 90 (1 0 0)
    arc 44 45 90 (1 0 0)
);

defaultPatch
{
    name walls;
    type wall;
}

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 1 2 3)
            (0 4 5 1)
            (1 5 6 2)
            (2 6 7 3)
            (3 7 4 0)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (40 41 42 43)
            (40 41 45 44)
            (41 42 46 45)
            (42 43 47 46)
            (43 40 44 47)
        );
    }
);

// ************************************************************************* //
